home *** CD-ROM | disk | FTP | other *** search
/ NetNews Offline 2 / NetNews Offline Volume 2.iso / news / comp / lang / c-part2 / 13629 < prev    next >
Encoding:
Internet Message Format  |  1996-08-05  |  1.5 KB

  1. Path: mail2news.demon.co.uk!genesis.demon.co.uk
  2. From: Lawrence Kirby <fred@genesis.demon.co.uk>
  3. Newsgroups: comp.lang.c
  4. Subject: Re: SIN?
  5. Date: Tue, 09 Apr 96 10:57:54 GMT
  6. Organization: none
  7. Message-ID: <829047474snz@genesis.demon.co.uk>
  8. References: <90.50656.1119@svis.org> <4kb63n$37g@umbc9.umbc.edu>
  9. Reply-To: fred@genesis.demon.co.uk
  10. X-NNTP-Posting-Host: genesis.demon.co.uk
  11. X-Newsreader: Demon Internet Simple News v1.27
  12. X-Mail2News-Path: genesis.demon.co.uk
  13.  
  14. In article <4kb63n$37g@umbc9.umbc.edu>
  15.            schlein@umbc.edu "Jonas J. Schlein" writes:
  16.  
  17. >Cory Pollock <cory.pollock@svis.org> wrote:
  18. >|> Can someone please wirte a little program to show me what the function
  19. >|> SIN((FLOAT)X) does?
  20. >
  21. >It doesn't do anything because SIN() is not a standard C function. Perhaps
  22. >you mean sin()? With a case sensitive language you need to be careful.
  23. >Assuming all lowercase for moment then it will cast the value of x to
  24. >float, pass this to the sin() function which will return a result.
  25.  
  26. The cast converts the value of X to a float but it is then converted to
  27. double before being passed to sin().
  28.  
  29. >To be
  30. >honest the cast isn't really necessary if using an ANSI C compiler with
  31. >a correct prototype for sin() in scope.
  32.  
  33. The cast may well reduce the accuracy of the result. Without it the
  34. value could have been converted to double directly.
  35.  
  36. -- 
  37. -----------------------------------------
  38. Lawrence Kirby | fred@genesis.demon.co.uk
  39. Wilts, England | 70734.126@compuserve.com
  40. -----------------------------------------
  41.